<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.Map" %>
<%@ page import="cn.dongqihong.hehe.Sign" %>
<%@ page import="cn.dongqihong.hehe.JsapiTicketCreater" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>顶呱呱政企服务中心 邀请函</title>
    <meta name="description" content="邀您12月12日10:00参加 武侯区－顶呱呱政企服务中心开业仪式"/>
    <link rel="stylesheet" type="text/css" href="index.css"/>
</head>
<body>
<%
    String ticket = JsapiTicketCreater.getJsapiTicket(application);
    String url = "http://" + request.getServerName() + request.getContextPath() + request.getRequestURI();
    if (request.getQueryString() != null) {
        url += "?" + request.getQueryString();
    }
    Map<String, String> rs = Sign.sign(ticket, url);

    String name = request.getParameter("name");
%>
<div class="warp main">
    <img class="bg" src="img?name=<%=name%>" style="height: auto;">
</div>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" type="text/javascript" charset="utf-8"></script>
<script>
    wx.config({
        debug: false,
        appId: 'wx71d8d8ec094b7897',
        timestamp: '<%=rs.get("timestamp")%>',
        nonceStr: '<%=rs.get("nonceStr")%>',
        signature: '<%=rs.get("signature")%>',
        jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage']
    });
    wx.ready(function () {
        wx.onMenuShareTimeline({
            title: '顶呱呱政企服务中心 邀请函',
            link: '<%=url%>',
            imgUrl: 'http://a.dgg.net/ico.png',
            desc: '邀您12月12日10:00参加 武侯区－顶呱呱政企服务中心开业仪式',
            success: function () {
                console.info('分享成功！');
            },
            cancel: function () {
                console.info('分享已取消！');
            }
        });
        wx.onMenuShareAppMessage({
            title: '顶呱呱政企服务中心邀请函',
            desc: '邀您12月12日10:00参加 武侯区－顶呱呱政企服务中心开业仪式',
            link: '<%=url%>',
            imgUrl: 'http://a.dgg.net/ico.png',
            type: 'link',
            dataUrl: '',
            success: function () {
                console.info('分享成功！');
            },
            cancel: function () {
                console.info('分享已取消！');
            }
        });
    });
</script>
</body>
</html>
